import 'dart:io';
import 'package:get/get.dart';
import '../routes/app_pages.dart';

/// 平台服务 - Platform Service
///
/// 管理不同平台的启动流程和特定功能
/// Manages startup flow and platform-specific features for different platforms
class PlatformService extends GetxService {
  
  /// 初始化平台特定流程 - Initialize platform-specific flow
  static Future<void> initializePlatformFlow() async {
    if (Platform.isAndroid) {
      // Android平台：显示权限授权页面 - Android: Show permission authorization page
      Get.offAllNamed(Routes.permission);
    } else if (Platform.isWindows) {
      // Windows平台：直接进入闪屏页面 - Windows: Go directly to splash screen
      Get.offAllNamed(Routes.splash);
    } else {
      // 其他平台：直接进入主页 - Other platforms: Go directly to home
      Get.offAllNamed(Routes.home);
    }
  }

  /// 检查是否为Android平台 - Check if Android platform
  static bool get isAndroid => Platform.isAndroid;

  /// 检查是否为Windows平台 - Check if Windows platform
  static bool get isWindows => Platform.isWindows;

  /// 检查是否为iOS平台 - Check if iOS platform
  static bool get isIOS => Platform.isIOS;

  /// 检查是否为macOS平台 - Check if macOS platform
  static bool get isMacOS => Platform.isMacOS;

  /// 检查是否为Linux平台 - Check if Linux platform
  static bool get isLinux => Platform.isLinux;

  /// 检查是否为Web平台 - Check if Web platform
  static bool get isWeb => GetPlatform.isWeb;

  /// 检查是否为移动平台 - Check if mobile platform
  static bool get isMobile => Platform.isAndroid || Platform.isIOS;

  /// 检查是否为桌面平台 - Check if desktop platform
  static bool get isDesktop => Platform.isWindows || Platform.isMacOS || Platform.isLinux;
}